use std::net::UdpSocket;

fn main() {
    let server = UdpSocket::bind("0.0.0.0:3090").unwrap();
    server.set_broadcast(true).unwrap();
    let mut buf = [0; 1024];
    loop {
        if let Ok((len, addr)) = server.recv_from(&mut buf) {
            let msg = String::from_utf8_lossy(&buf[..len]);
            println!("{}", msg);
            if msg.contains("FIND-LC-ROOM") {
                let room_info = "A Static Room,1130";
                server.send_to(room_info.as_bytes(), addr).unwrap();
            }
        }
    }
}